package pms.dao.impl;



import pms.dao.SupplierDao;
import pms.entity.Supplier;
import pms.until.JDBCTools;

import java.sql.ResultSet;
import java.sql.SQLException;

public class SupplierDaoImpl implements SupplierDao {
    private JDBCTools tools=new JDBCTools();
    @Override
    public Supplier querySupplierById(Integer id) {
        Supplier supplier=null;
        ResultSet rs=tools.query("select supplier_name from t_supplier where supplier_id=?",id);

        try {
            if (rs.next()){
                supplier=new Supplier();
                supplier.setSupplier_name(rs.getString("supplier_name"));
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }finally {
            tools.clossAll();
        }
        return supplier;
    }
}
